package cn.dglydrpy.study.spring.ioc.annotation;
/*
 * @Description:演示基于注解的依赖注入(DI) 
 * @author:dglydrpy
 * @date:2019年4月17日 上午12:57:53 
 */

import java.io.Serializable;

import javax.annotation.Resource;

import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import cn.dglydrpy.study.spring.ioc.xml.LifeCycleBean;
@Component
@Lazy // 默认值为true,开启懒加载
public class AnnotationDIBean implements Serializable{

	private static final long serialVersionUID = 1L;

	@Resource //对象属性注入
	private AnnotationLifeCycleBean annocationLifeCycleBean;

	private LifeCycleBean lifeCycleBean;

	public AnnotationLifeCycleBean getAnnocationLifeCycleBean() {
		return annocationLifeCycleBean;
	}

	public void setAnnocationLifeCycleBean(AnnotationLifeCycleBean annocationLifeCycleBean) {
		this.annocationLifeCycleBean = annocationLifeCycleBean;
	}

	public LifeCycleBean getLifeCycleBean() {
		return lifeCycleBean;
	}
	@Resource  //bean属性setter注入
	public void setLifeCycleBean(LifeCycleBean lifeCycleBean) {
		this.lifeCycleBean = lifeCycleBean;
	}

	@Override
	public String toString() {
		return "AnnotationDIBean [annocationLifeCycleBean=" + annocationLifeCycleBean + ", lifeCycleBean="
				+ lifeCycleBean + "]";
	}
}
